<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>有奖答题平台</title>
    <!-- ICON -->
    <link href="/frame/images/meatball.ico" type="image/ico" rel="shortcut icon">
    <!-- CSS -->
    <link rel="stylesheet" href="/lib/layuiadmin/layui/css/layui.css" media="all" />
<!--    <link rel="stylesheet" href="/lib/layuiadmin/css/admin.css" media="all">-->
    <link rel="stylesheet" href="/lib/layuiadmin/css/login.css" media="all">
    <link rel="stylesheet" href="/lib/nprogress/nprogress.css" media="all">
    <link rel="stylesheet" href="/login2/css/style.css" media="all">
</head>
<body class="denglu02">

<div class="dl">
    <div class="biaoti" style="margin-top: 170px"><img src="/login2/css/images/logo.png" /></div>
    <div class="log" style="margin-top: -70px">
        <ul class="xuzhi02">
            <li class="xz">系统描述</li>
            <li>1.</li>
            <li>2.</li>
            <li>3.</li>
        </ul>
        <ul class="deng02" style="margin-left: 7px;">
            <li>
                <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;padding-top:10px">
                    <div class="layadmin-user-login-main">
                        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                            <div class="layui-form-item">
                                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username" style="z-index:2"></label>
                                <input type="text" name="account" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                            </div>
                            <div class="layui-form-item">
                                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password" style="z-index:2"></label>
                                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                            </div>

                            <div class="layui-form-item" style="margin-bottom: 20px;">
                                <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登入后台</button>
                            </div>

                        </div>
                    </div>

                </div>
            </li>
<!--            <div style="clear:both;"></div>-->

<!--            <li style=" width:100%; height:60px;">-->
<!--                <p style="float:left;font-size:18px; color:#666;line-height:30px; ">密&nbsp;&nbsp;&nbsp;码:</p>-->
<!--                <input id="username" class="i-text" type="text" errormsg="用户名至少6个字符,最多18个字符！" datatype="s6-18" ajaxurl="demo/valid.jsp" maxlength="100" value="输入账号">-->
<!--            </li>-->
<!--            <div style="clear:both;"></div>-->
<!--            <li style=" width:100%; height:60px;">-->
<!--                <p style="float:left;font-size:18px; color:#666;line-height:30px; ">验证码:</p>-->
<!--                <input id="username" class="i-text" type="text" errormsg="用户名至少6个字符,最多18个字符！" datatype="s6-18" ajaxurl="demo/valid.jsp" maxlength="100" value="输入账号">-->
<!--            </li>-->
<!--            <li style=" width:100%; height:60px;">-->
<!--                <button id="logonbtn" class="btn-login02" onclick="LoginPage.gotoLogin();" type="button" >-->
<!--                    <span>登&nbsp;&nbsp;&nbsp;&nbsp;录</span>-->
<!--                </button>-->
<!--            </li>-->
        </ul>


    </div>
</div>

<script type="text/javascript" src="/lib/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/lib/nprogress/nprogress.js"></script>
<script>
layui.config({
    base: '/lib/layuiadmin/' //静态资源所在路径
}).extend({
    index: 'lib/index' //主入口模块
}).use('index', function() {
    var $ = layui.jquery,
        form = layui.form;

    form.render();
    //提交
    form.on('submit(LAY-user-login-submit)', function (obj) {
        NProgress.start();
        //请求登入接口
        $.ajax({
            url: '/validate',
            type: 'POST',
            data: obj.field,
            dataType: 'json',
            success: function (res) {
                console.log(res.code);
                if(res.code != 10000) {
                    layer.msg(res.message, {icon: 5});
//					return false;
                } else {
                    // window.location.href = '/';
                    window.location.replace("/");
//					return true;
                }
                NProgress.done();
            }
        });
        return false;
    });

});
</script>
</body>
</html>